package com.itheima.sh.examination.test.test;

import java.util.Arrays;
import java.util.Random;

public class one {
    public static void main(String[] args) {
        Random r = new Random();
        int[] arr = new int[5];
        for (int i = 0; i < arr.length; i++) {
            int a = r.nextInt(100) + 1;
            arr[i] = a;
        }
        System.out.println(Arrays.toString(arr));
        int max = arr[0];
        int min = arr[0];
        int sum = 0;
        double average = 0;
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] > max) {
                max = arr[i];
            }
            if (arr[i] < min) {
                min = arr[i];
            }
            sum += arr[i];
            average = sum / 5.0;

        }
        System.out.println("5个随机数最大值为:" + max);
        System.out.println("5个随机数最小值为:" + min);
        System.out.println("5个随机数的和值为:" + sum);
        System.out.println("5个随机数的平均数为:" + average);

    }
}

